package com.stenio.fancat.controller.shop;

import com.stenio.fancat.controller.Result;
import com.stenio.fancat.domain.shop.FcGift;
import com.stenio.fancat.service.shop.GiftService;
import com.stenio.fancat.util.EmptyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author liuan
 * @create 2019-02-27 20:47
 */
@RestController
@RequestMapping("gift")
public class GiftController {

    @Autowired
    GiftService giftService;

    @PostMapping("findAll")
    @ResponseBody
    public Result findAll(){
        Result result = new Result();
        List<FcGift> fcGifts = giftService.selectList(null);
        if(EmptyUtil.isEmpty(fcGifts)) {
            result.setFlag(Result.FLAG.failure);
            return result;
        }
        result.setData(fcGifts);
        return result;
    }

}
